home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / boot / netBoot.new / sun3src / patt.s < prev    next >
Encoding:
Text File  |  1990-12-19  |  4.3 KB  |  157 lines

  1.  
  2. |
  3. |    @(#)patt.s 1.1 86/09/27
  4. |    Copyright (c) 1986 by Sun Microsystems, Inc.
  5. |
  6. |    these routines fill and check memory blocks with constant
  7. |    patterns.
  8. |
  9. |    [o_][b|w|l]{p,}fill(address, size, pattern)
  10. |        fills the block at address for size bytes with pattern.
  11. |        fill/check with no prefix for backward compatibility.
  12. |        o_& is dummy routine for fill, for consistentcy.
  13. |    [o_][b|w|l]{p,}check(address, size, pattern)
  14. |        checks to see that the pattern is in the block given.
  15. |        o_& prefix causes check to return obs_value if check
  16. |        fails, but does NOT use loop mode to do so.  Regular
  17. |        version does give loop mode, but no observed value.
  18. |
  19. |    .data
  20. |    .asciz    "@(#)patt.s 1.4 10/12/84 Copyright Sun Micro"
  21. |    .even
  22.     .text
  23.     .globl    _bfill, _wfill, _lfill
  24.     .globl    _bpfill, _wpfill, _lpfill
  25.     .globl    _bcheck, _wcheck, _lcheck
  26.     .globl    _bpcheck, _wpcheck, _lpcheck
  27.  
  28.     .globl    _o_bcheck, _o_wcheck, _o_lcheck
  29.     .globl    _o_bpcheck, _o_wpcheck, _o_lpcheck
  30.  
  31.     .globl    bdb_unpack, wdb_unpack, ldb_unpack
  32.     .globl    bdb_pack, wdb_pack, ldb_pack
  33.     .globl    _obs_value, _exp_value
  34.  
  35. fillstart:
  36.     movl    sp@+, a1        | save return (off stack tho)
  37.     link    a6, #0
  38.     movl    a6@(12), d0        | get count
  39.     tstl    d0            | if count zero, return now
  40.     beqs    fillend2
  41.     movl    d7, sp@-        | save d7
  42.     movl    d6, sp@-        | only used in o_, but WTH
  43.     clrl    d6            | clear obs_value register
  44.     movl    a6@(16), d7        | get pattern into d7
  45.     movl    a6@(8), a0        | get buffer address
  46.     jmp    a1@            | use rts address (unpack now)
  47.  
  48. fillend:
  49.     movl    d6, _obs_value        | only valid for o_&check
  50.     movl    d7, _exp_value        | valid for any check.
  51.     movl    sp@+, d6
  52.     movl    sp@+, d7
  53. fillend2:
  54.     unlk    a6
  55.     rts
  56.  
  57. _bfill:
  58. _bpfill:
  59.     jsr    fillstart        | set up fill registers
  60.     jsr    bdb_unpack        | get d0 setup for dbra
  61. 1$:    movb    d7, a0@+        | stuff into memory
  62.     dbra    d0, 1$            | decrement until not equal
  63.     dbra    d1, 1$            | decrement until not equal
  64.     jra    fillend            | do cleanup
  65.  
  66. _wfill:
  67. _wpfill:
  68.     jsr    fillstart        | set up fill registers
  69.     jsr    wdb_unpack        | get d0 setup for dbra
  70. 1$:    movw    d7, a0@+        | stuff into memory
  71.     dbra    d0, 1$            | decrement until not equal
  72.     dbra    d1, 1$            | decrement until not equal
  73.     jra    fillend            | do cleanup
  74.  
  75. _lfill:
  76. _lpfill:
  77.     jsr    fillstart        | set up fill registers
  78.     jsr    ldb_unpack        | get d0 setup for dbra
  79. 1$:    movl    d7, a0@+        | stuff into memory
  80.     dbra    d0, 1$            | decrement until not equal
  81.     dbra    d1, 1$            | decrement until not equal
  82.     jra    fillend            | do cleanup
  83. |
  84. |    checks come in two flavors, regular (fast) and o_& (slow)
  85. |    the o_ version returns a real obs_value at the end, and does NOT
  86. |    use loop mode.  The regular is faster with loop mode, but
  87. |    cannot return the real observed value.
  88. |
  89. _bcheck:
  90. _bpcheck:
  91.     jsr    fillstart        | get prams (if needed)
  92.     jsr    bdb_unpack
  93.     andl    #0xff, d7        | clear out expected bits we dont use
  94. 1$:    cmpb    a0@+, d7        | check value
  95.     dbne    d0, 1$
  96.     dbne    d1, 1$            | loop till value mismatch or done
  97.     jsr    bdb_pack        | construct return
  98.     jra    fillend            | then finish up
  99.  
  100. _wcheck:
  101. _wpcheck:
  102.     jsr    fillstart        | get prams (if needed)
  103.     jsr    wdb_unpack
  104.     andl    #0xffff, d7        | clear out expected bits we dont use
  105. 1$:    cmpw    a0@+, d7        | check value
  106.     dbne    d0, 1$
  107.     dbne    d1, 1$            | loop till value mismatch or done
  108.     jsr    wdb_pack        | construct return
  109.     jra    fillend            | then finish up
  110.  
  111. _lcheck:
  112. _lpcheck:
  113.     jsr    fillstart        | get prams (if needed)
  114.     jsr    ldb_unpack
  115. 1$:    cmpl    a0@+, d7        | check value
  116.     dbne    d0, 1$
  117.     dbne    d1, 1$            | loop till value mismatch or done
  118.     jsr    ldb_pack        | construct return
  119.     jra    fillend            | then finish up
  120. |
  121. | return observed pattern versions
  122. |
  123. _o_bcheck:
  124. _o_bpcheck:
  125.     jsr    fillstart        | get prams (if needed)
  126.     jsr    bdb_unpack
  127.     andl    #0xff, d7        | clear out expected bits we dont use
  128. 1$:    movb    a0@+, d6        | check value
  129.     cmpb    d7, d6            | with expected value
  130.     dbne    d0, 1$
  131.     dbne    d1, 1$            | loop till value mismatch or done
  132.     jsr    bdb_pack        | construct return
  133.     jra    fillend            | then finish up
  134.  
  135. _o_wcheck:
  136. _o_wpcheck:
  137.     jsr    fillstart        | get prams (if needed)
  138.     jsr    wdb_unpack
  139.     andl    #0xffff, d7        | clear out expected bits we dont use
  140. 1$:    movw    a0@+, d6        | check value
  141.     cmpw    d7, d6            | with expected value
  142.     dbne    d0, 1$
  143.     dbne    d1, 1$            | loop till value mismatch or done
  144.     jsr    wdb_pack        | construct return
  145.     jra    fillend            | then finish up
  146.  
  147. _o_lcheck:
  148. _o_lpcheck:
  149.     jsr    fillstart        | get prams (if needed)
  150.     jsr    ldb_unpack
  151. 1$:    movl    a0@+, d6        | check value
  152.     cmpl    d7, d6            | with expected value
  153.     dbne    d0, 1$
  154.     dbne    d1, 1$            | loop till value mismatch or done
  155.     jsr    ldb_pack        | construct return
  156.     jra    fillend            | then finish up
  157.